#ifndef UTILS_H
#define UTILS_H
#include <stdlib.h> //pour exit(0);
#include <goocanvas.h>


//fenetre
GtkWidget* simple_win(int w,int h);
void on_delete_event(GtkWidget* emitter, GdkEvent evt, gpointer nothing);

//crée une fenêtre (GtkWidget*) de taille int w,int h,qu'on colle à pWin
//crée un widget canvas (GtkWidget*) qu'on colle à canvas,
//chope le GooCanvasItem* racine de ce canvas qu'on colle à root
#define CANVAS_WIN_ROOT_NEW(canvas,pWin,root,w,h); \
	gtk_set_locale(); \
	gtk_init(&argc,&argv); \
	pWin = simple_win(w,h); \
	canvas = goo_canvas_new(); \
	gtk_widget_set_size_request(canvas,300,200); \
	goo_canvas_set_bounds(GOO_CANVAS(canvas),0,0,1000,1000); \
	gtk_widget_show(canvas); \
	gtk_container_add(GTK_CONTAINER(pWin),canvas); \
	root = goo_canvas_get_root_item(GOO_CANVAS(canvas));

#define ONCE(fct_name,param) g_timeout_add(1000,(fct_name),param);
#define ONCE_FCT_START(fct_name,parameter_name) gboolean (fct_name) (gpointer (parameter_name))
#define ONCE_FCT_END return FALSE; }

#endif